var currList = null;

function resetListHeight()
{
	var itemHeight = document.body.clientHeight;
	var divs = document.getElementsByTagName('div');
	for (var i=0; i<divs.length; i++)
	{
		if (divs[i].className == 'Header' || divs[i].className == 'HeaderOver')
		{
			itemHeight = itemHeight - divs[i].offsetHeight;
			if (itemHeight <= 67)
			{
				itemHeight = 67;
				break;
			}
		}
	}
	for (var i=0; i<divs.length; i++)
	{
		if (divs[i].className == 'Items')
			divs[i].style.height = itemHeight;
	}
}

function ListClick(list)
{
	if (currList == null)
	{
		currList = list;
		ExpandList();
		return;
	}
	
	if (currList != list)
	{
		ShrinkList();
		currList = list;
		ExpandList();
		return;
	}
	ShrinkList();
	currList = null;
}

function ExpandList()
{
	var itemid = currList.id + "_I";
	var headerid = currList.id + "_H";
	var item = document.getElementById(itemid);
	var header = document.getElementById(headerid);
	item.style.display = '';
	header.oldClassName = 'HeaderOver';
}

function ShrinkList()
{
	var itemid = currList.id + "_I";
	var headerid = currList.id + "_H";
	var item = document.getElementById(itemid);
	var header = document.getElementById(headerid);
	item.style.display = 'none';
	header.oldClassName = 'Header';
	header.className = 'Header';
}

function ItemClick(item)
{
	window.open(item.href, item.target);
}
